﻿import mx.utils.Delegate;
class cn.eminia.RClassV3.Btn {
	// [置顶]
	// new cn.eminia.RClassV3.Btn(btnUp,btnDown);
	var up:MovieClip;
	var dn:MovieClip;
	var per:Number;
	var per_:Number;
	var ctrl:MovieClip;
	function Btn(a, b) {
		this.up = a;
		this.dn = b;
		this.per_ = 0;
		//
		var dd = _root.getNextHighestDepth();
		this.ctrl = _root.createEmptyMovieClip('ctrl_RClassV3_Btn'+dd, dd);
		//
		up.onPress = Delegate.create(this, function () {
			ctrl.onEnterFrame = Delegate.create(this, function () {
				per_ -= .01;
				per_ = Math.max(0, per_);
				this.per = per_;
			});
		});
		dn.onPress = Delegate.create(this, function () {
			ctrl.onEnterFrame = Delegate.create(this, function () {
				per_ += .01;
				per_ = Math.min(1, per_);
				this.per = per_;
			});
		});
		up.onRelease = up.onReleaseOutside=Delegate.create(this, function () {
			delete ctrl.onEnterFrame;
		});
		dn.onRelease = dn.onReleaseOutside=Delegate.create(this, function () {
			delete ctrl.onEnterFrame;
		});
	}
	function updatePos(prop, oldVal, newVal) {
		this.per_ = newVal;
	}
}
